﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.IO;

namespace dotsoftRAID_Service
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }

        private Process RAIDController;

        protected override void OnStart(string[] args)
        {
            RAIDController = new Process();
            RAIDController.StartInfo.FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "dotsoftRAID Controller.exe");
            RAIDController.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            RAIDController.Start();
        }

        protected override void OnStop()
        {
            RAIDController.Kill();
        }
    }
}
